package com.ztn.iot.zhonghaichi2.push2.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@Data
public class DataReq2 {

    public static final String URL="https://iot.gdwater.gov.cn:8883";

    @JsonProperty("id")
    private String id;
    @JsonProperty("version")
    private String version;
    @JsonProperty("params")
    private ParamsDTO params;


    @Data
    public static class ParamsDTO {
        @JsonProperty("gatewayCode")
        private GatewayCodeDTO gatewayCode;
        @JsonProperty("gatewayType")
        private GatewayTypeDTO gatewayType;
        @JsonProperty("time")
        private TimeDTO time;
        @JsonProperty("version")
        private VersionDTO version;
        @JsonProperty("collectedData")
        private CollectedDataDTO collectedData;


        @AllArgsConstructor
        @NoArgsConstructor
        @Data
        public static class GatewayCodeDTO {
            @JsonProperty("value")
            private String value;
        }

        @AllArgsConstructor
        @NoArgsConstructor
        @Data
        public static class GatewayTypeDTO {
            @JsonProperty("value")
            private String value;
        }

        @AllArgsConstructor
        @NoArgsConstructor
        @Data
        public static class TimeDTO {
            @JsonProperty("value")
            private Long value;
        }

        @AllArgsConstructor
        @NoArgsConstructor
        @Data
        public static class VersionDTO {
            @JsonProperty("value")
            private String value;
        }


        @Data
        public static class CollectedDataDTO {
            @JsonProperty("value")
            private List<ValueDTO> value;


            @Data
            public static class ValueDTO {
                @JsonProperty("value")
                private Double value;
                @JsonProperty("rawValue")
                private String rawValue;
                @JsonProperty("collectTime")
                private Long collectTime;
                @JsonProperty("equipmentModel")
                private String equipmentModel;
                @JsonProperty("identifier")
                private String identifier;
                @JsonProperty("drawingNum")
                private String drawingNum;
                @JsonProperty("addr")
                private String addr;
                @JsonProperty("other")
                private String other;
            }
        }
    }
}
